package tools.settings;

import javax.naming.directory.InvalidAttributesException;

/**
 *
 * @author Lynne Vandousselaere
 */
public class SettingsMissingException extends InvalidAttributesException {

    private String[] missing_settings;

    public String[] getMissing_settings() {
        return missing_settings;
    }

    public SettingsMissingException(String message){
        super(message);
    }

    public SettingsMissingException(String message, String[] missing_settings){
        super(message);
        this.missing_settings = missing_settings;
    }

    public static SettingsMissingException generate(String classname, String methodname, String[] needed_settings) {
        String s = (classname + " - (" + methodname + ") " +
                "some needed settings don't exists. " +
                "Needed settings for this class: \"" +
                parseArray(needed_settings) + 
                "\"");
        return new SettingsMissingException(s, needed_settings);
    }


    private static String parseArray(String[] array){
        String s = "";
        for(int i = 0; i < array.length; i++)
            s += array[i] + ", ";
        return s;

    }

}
